package com.springboot.seckill.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 用于获取时间
 * @Author: HuangDekai
 * @Date: 2022/3/25 15:52
 * @Version: 1.0
 * @since: jdk11
 */
public class TimeUtils {
    /**
     * 获取当前时间的字符串(格式:yyyyMMddHHmmss, 如:20220325155259)
     * @return yyyyMMddHHmmss格式字符串
     */
    public static String getNowTimeString() {
        LocalDateTime now = LocalDateTime.now();
        return now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
    }
}
